from PIL import Image
import os
from tqdm import tqdm

folder_path = 'F:\\items\\bike-model\\搜集的数据集\\自行制作的\\JPEGImages'
output_folder_path = 'F:\\items\\bike-model\\搜集的数据集\\自行制作的\\zzxi'
new_size = (640, 640)

for filename in tqdm(os.listdir(folder_path)):
    file_path = os.path.join(folder_path, filename)
    image = Image.open(file_path)
    image = image.resize(new_size, Image.Resampling.LANCZOS)
    output_file_path = os.path.join(output_folder_path, filename)
    image.save(output_file_path)
